//
// Created by xbm on 23-3-1.
//
#pragma once

#include <string>
#include <memory>

#include "fmt/format.h"

#include "logWriter.h"
#include "nonCopyable.h"

using namespace std;

namespace logging {
enum class LogLevel {
    MESSAGE,
    STATUS,
    WARNING,
    ERROR,
    FATAL,
};

class Logger : util::NonCopyable {
public:

    static Logger &get_instance() {
        static Logger logger;
        return logger;
    }

    void log(string_view);

    void log(string_view, LogLevel);

private:
    Logger(const string &filename =
    R"(/home/xbm/CLionProjects/web-server/log.txt)",
           LogLevel log_level = LogLevel::MESSAGE);

    string get_formatted_time();

    string get_status_msg(LogLevel);


    logWriter::AscynLogWriter writer;
    string filename_;
    LogLevel log_level_;
};
}

